#1082 hasPerm API call should raise GenericError exception for non permission
Closed: Fixed 5 years ago Opened 5 years ago by jcupova.

Steps to Reproduce:

Run env.session.hasPerm(non-exist-perm)

Actual result:

False

Expected result:

Should return the error message.


Metadata Update from @julian8628:
- Issue tagged with: easyfix

5 years ago

PR #1099 adds a strict option, which defaults to false. This is not quite the behavior asked for, because it will only raise an error if the strict option is explicitly set to true.

I'm think the solution in #1099 is the correct one. Technically, a False result for hasPerm(non-exist-perm) is correct. The user definitely does not have a perm that does not exist.

There may be code that in the wild that relies on this, perhaps implicitly. Or perhaps I'm being paranoid.

Otoh, if you feel strongly that an error should always be raised in such cases, or raised by default, then we can discuss it more.

For the one side, yes, it is correct when the result for hasPerm(non-exist-perm) is False. Yes, the user does not have a perm that does not exist. But I guess that better is that we can check that permission is exist and when not, we should return an error.

@jcupova, so are you objecting to the given solution?

Most hub calls in Koji tend to be friendly by default, and only raise errors either when strict is specified, or when there is no reasonable return value. Here there is a reasonable return value.

+1 for 'strict' solution

Also +1 for 'strict' solution

Metadata Update from @julian8628:
- Issue set to the milestone: 1.17

5 years ago

Login to comment on this ticket.

Metadata