rightsFromScope is the opposite of RightsToScope. It transforms the string "scope" back into a list of rights. This function is only used for compatibility with osin.
(scope string)
| 57 | // rightsFromScope is the opposite of RightsToScope. It transforms the string "scope" back into a list of rights. |
| 58 | // This function is only used for compatibility with osin. |
| 59 | func rightsFromScope(scope string) []ttnpb.Right { |
| 60 | scopes := strings.Split(scope, " ") |
| 61 | rights := make([]ttnpb.Right, 0, len(scopes)) |
| 62 | for _, scope := range scopes { |
| 63 | if right, ok := ttnpb.Right_value[scope]; ok { |
| 64 | rights = append(rights, ttnpb.Right(right)) |
| 65 | } |
| 66 | } |
| 67 | return ttnpb.RightsFrom(rights...).Sorted().GetRights() |
| 68 | } |
| 69 | |
| 70 | var ( |
| 71 | errClientMissingGrant = errors.DefinePermissionDenied("client_missing_grant", "OAuth client does not have {grant} grant") |
no test coverage detected