-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor: Introduce administrative permission service #3172
refactor: Introduce administrative permission service #3172
Conversation
f623943
to
817e78a
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3172 +/- ##
===========================================
+ Coverage 13.22% 88.80% +75.57%
===========================================
Files 270 271 +1
Lines 22244 22206 -38
===========================================
+ Hits 2941 19719 +16778
+ Misses 19303 2487 -16816 ☔ View full report in Codecov by Sentry. |
0e31326
to
06bd4ee
Compare
…nd PermissionsRestService
…#permissionsDataGetADM accept only a KnoraUser
e806b4a
to
8f17f68
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
ApiRoutes & AdminApiEndpoints & ApiV2Endpoints & AppRouter & AssetPermissionsResponder & Authenticator & | ||
AuthorizationRestService & CacheServiceRequestMessageHandler & CardinalityHandler & ConstructResponseUtilV2 & | ||
DspIngestClient & GravsearchTypeInspectionRunner & GroupsResponderADM & GroupsRestService & GroupService & | ||
HttpServer & IIIFRequestMessageHandler & InferenceOptimizationService & IriConverter & ListsResponder & | ||
HttpServer & IIIFRequestMessageHandler & InferenceOptimizationService & IriConverter & KnoraUserToUserConverter & ListsResponder & | ||
ListsResponderV2 & MessageRelay & OntologyCache & OntologyHelpers & OntologyInferencer & OntologyRepo & | ||
OntologyResponderV2 & PermissionUtilADM & PermissionsResponderADM & PermissionsRestService & ProjectExportService & | ||
OntologyResponderV2 & PermissionUtilADM & PermissionsResponder & PermissionsRestService & ProjectExportService & | ||
ProjectExportStorageService & ProjectImportService & ProjectService & ProjectRestService & QueryTraverser & | ||
RepositoryUpdater & ResourceUtilV2 & ResourcesResponderV2 & RestCardinalityService & SearchApiRoutes & | ||
SearchResponderV2 & StandoffResponderV2 & StandoffTagUtilV2 & State & TestClientService & TriplestoreService & |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion: could we put those on one line each? Scalafmt doesn't do it automatically, but it doesn't undo it either, I think. And the diffs would be less nasty.
import org.knora.webapi.slice.admin.domain.model.UserStatus | ||
import org.knora.webapi.slice.admin.domain.model.Username | ||
|
||
object KnoraUserToUserConverterSpec extends E2EZSpec { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
question: in its nature, this test is not an end-to-end test. Should it really be derived from E2EZSpec
?
CacheServiceRequestMessageHandler & CardinalityHandler & ConstructResponseUtilV2 & | ||
GravsearchTypeInspectionRunner & GroupsResponderADM & GroupsRestService & GroupService & HttpServer & | ||
IIIFRequestMessageHandler & InferenceOptimizationService & InstrumentationServerConfig & IriConverter & | ||
JwtService & ListsResponder & ListsResponderV2 & MessageRelay & OntologyCache & OntologyHelpers & | ||
OntologyInferencer & OntologyResponderV2 & PermissionsResponderADM & PermissionsRestService & | ||
JwtService & KnoraUserToUserConverter & ListsResponder & ListsResponderV2 & MessageRelay & OntologyCache & OntologyHelpers & | ||
OntologyInferencer & OntologyResponderV2 & PermissionsResponder & PermissionsRestService & | ||
PermissionUtilADM & ProjectService & ProjectExportService & ProjectExportStorageService & | ||
ProjectImportService & ProjectRestService & QueryTraverser & RepositoryUpdater & ResourcesResponderV2 & | ||
ResourceUtilV2 & ResourceUtilV2 & RestCardinalityService & SearchApiRoutes & |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as above
AppConfig & AssetPermissionsResponder & AuthorizationRestService & BaseEndpoints & CacheService & | ||
AppConfig & AdministrativePermissionService & AssetPermissionsResponder & AuthorizationRestService & BaseEndpoints & CacheService & | ||
GroupsResponderADM & GroupService & HandlerMapper & KnoraProjectService & KnoraResponseRenderer & | ||
KnoraUserService & KnoraUserToUserConverter & ListsResponder & MaintenanceService & OntologyCache & | ||
PasswordService & PermissionsResponderADM & ProjectExportService & ProjectImportService & ProjectService & | ||
PasswordService & PermissionsResponder & ProjectExportService & ProjectImportService & ProjectService & |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as above
/* Follow the precedence rule: | ||
1. ProjectAdmin > 2. CustomGroups > 3. ProjectMember > 4. KnownUser | ||
Permissions are added following the precedence level from the highest to the lowest. As soon as one set | ||
of permissions is written into the buffer, any additionally permissions do not need to be added. */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would suggest to move it to docsstring above, which will make it visible on function hover.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TBH, I was even considering to remove it. However it explains why the implementation below is how it is and I think that is the right place.
def toKnoraGroup(group: Group): KnoraGroup = | ||
KnoraGroup( | ||
id = GroupIri.unsafeFrom(group.id), | ||
groupName = GroupName.unsafeFrom(group.name), | ||
groupDescriptions = GroupDescriptions.unsafeFrom(group.descriptions), | ||
status = GroupStatus.from(group.status), | ||
belongsToProject = group.project.map(it => ProjectIri.unsafeFrom(it.id)), | ||
hasSelfJoinEnabled = GroupSelfJoin.from(group.selfjoin), | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you bring it back please? It is unused not, but will be soon - group slice WIP.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please readd it yourself when in use and ideally tested.
Pull Request Checklist
Task Description/Number
Issue Number: DEV-
PR Type
Basic requirements for bug fixes and features
Does this PR introduce a breaking change?
Does this PR change client-test-data?