Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
caosdb-server
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
caosdb
Software
caosdb-server
Commits
e4691ff2
Verified
Commit
e4691ff2
authored
4 years ago
by
Timm Fitschen
Browse files
Options
Downloads
Patches
Plain Diff
DOC: doc strings for AbstractEntityACLFactory
parent
202e89bf
No related branches found
No related tags found
3 merge requests
!21
Release v0.4.0
,
!7
F fsm
,
!6
Draft: F acm permissions2
Pipeline
#5926
passed
4 years ago
Stage: test
Stage: deploy
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/java/org/caosdb/server/permissions/AbstractEntityACLFactory.java
+26
-3
26 additions, 3 deletions
...g/caosdb/server/permissions/AbstractEntityACLFactory.java
with
26 additions
and
3 deletions
src/main/java/org/caosdb/server/permissions/AbstractEntityACLFactory.java
+
26
−
3
View file @
e4691ff2
...
...
@@ -169,7 +169,17 @@ public abstract class AbstractEntityACLFactory<T extends EntityACL> {
return
create
(
acis
);
}
/**
* Normalize the permission rules.
*
* <p>This means that rules which are overriden by other rules are removed. E.g. a granting rule
* for the permission X and the agent P would be removed if there is a denial of X (for P) with
* the same or a higher priority. Likewise, A denial of Y for agent Q would be removed if there is
* a granting rule of Y (for Q) with a higher priority.
*/
private
void
normalize
()
{
// 1. run through all prioritized denials and remove overriden rules
// (priority grants, normal grants and normal denials)
Iterator
<
Entry
<
ResponsibleAgent
,
Long
>>
iterator
=
this
.
priorityDenials
.
entrySet
().
iterator
();
while
(
iterator
.
hasNext
())
{
Entry
<
ResponsibleAgent
,
Long
>
next
=
iterator
.
next
();
...
...
@@ -189,6 +199,8 @@ public abstract class AbstractEntityACLFactory<T extends EntityACL> {
this
.
normalGrants
.
put
(
agent
,
this
.
normalGrants
.
get
(
agent
)
&
~
bitset
);
}
}
// 2. run through all prioritized grants and remove overriden rules (normal
// denials and grants)
iterator
=
this
.
priorityGrants
.
entrySet
().
iterator
();
while
(
iterator
.
hasNext
())
{
Entry
<
ResponsibleAgent
,
Long
>
next
=
iterator
.
next
();
...
...
@@ -205,6 +217,7 @@ public abstract class AbstractEntityACLFactory<T extends EntityACL> {
this
.
normalGrants
.
put
(
agent
,
this
.
normalGrants
.
get
(
agent
)
&
~
bitset
);
}
}
// 3. run through all normal denials and remove overriden rules (normal grants)
iterator
=
this
.
normalDenials
.
entrySet
().
iterator
();
while
(
iterator
.
hasNext
())
{
Entry
<
ResponsibleAgent
,
Long
>
next
=
iterator
.
next
();
...
...
@@ -218,6 +231,7 @@ public abstract class AbstractEntityACLFactory<T extends EntityACL> {
this
.
normalGrants
.
put
(
agent
,
this
.
normalGrants
.
get
(
agent
)
&
~
bitset
);
}
}
// finally, remove all remaining empty grants
iterator
=
this
.
normalGrants
.
entrySet
().
iterator
();
while
(
iterator
.
hasNext
())
{
Entry
<
ResponsibleAgent
,
Long
>
next
=
iterator
.
next
();
...
...
@@ -237,9 +251,18 @@ public abstract class AbstractEntityACLFactory<T extends EntityACL> {
protected
abstract
T
create
(
Collection
<
EntityACI
>
acis
);
public
AbstractEntityACLFactory
<
T
>
remove
(
EntityACL
permissions
)
{
if
(
permissions
!=
null
)
{
for
(
EntityACI
aci
:
permissions
.
getRules
())
{
/**
* Remove all rules of the `other` EntityACL from this factory.
*
* <p>This is mainly used for removing all rules which belong to the global entity ACL from this
* ACL before storing it to the backend.
*
* @param other
* @return the same object with changed rule set.
*/
public
AbstractEntityACLFactory
<
T
>
remove
(
EntityACL
other
)
{
if
(
other
!=
null
)
{
for
(
EntityACI
aci
:
other
.
getRules
())
{
if
(
EntityACL
.
isAllowance
(
aci
.
getBitSet
()))
{
if
(
EntityACL
.
isPriorityBitSet
(
aci
.
getBitSet
()))
{
Long
bitset
=
this
.
priorityGrants
.
get
(
aci
.
getResponsibleAgent
());
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment