Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Stud.IP
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
Jan-Hendrik Willms
Stud.IP
Commits
c66d74dd
Commit
c66d74dd
authored
3 years ago
by
André Noack
Browse files
Options
Downloads
Patches
Plain Diff
Resolve "Sperrzeiten sperren auch globale Raumadmins"
parent
335af2fd
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
app/views/resources/admin/user_permissions.php
+1
-1
1 addition, 1 deletion
app/views/resources/admin/user_permissions.php
lib/models/resources/Resource.class.php
+22
-26
22 additions, 26 deletions
lib/models/resources/Resource.class.php
with
23 additions
and
27 deletions
app/views/resources/admin/user_permissions.php
+
1
−
1
View file @
c66d74dd
...
...
@@ -94,7 +94,7 @@
</td>
<td>
<?=
htmlReady
(
$permission
->
perms
)
?>
<?
if
(
$current_global_lock
and
(
$permission
->
perms
!=
'admin'
)
)
:
?>
<?
if
(
$current_global_lock
)
:
?>
<?=
Icon
::
create
(
'exclaim'
,
'attention'
)
->
asImg
(
'20px'
,
[
...
...
This diff is collapsed.
Click to expand it.
lib/models/resources/Resource.class.php
+
22
−
26
View file @
c66d74dd
...
...
@@ -2287,8 +2287,7 @@ class Resource extends SimpleORMap implements StudipItem
*/
public
function
getUserPermission
(
User
$user
,
$time_range
=
[],
$permanent_only
=
false
)
{
if
(
$user
->
perms
==
'root'
)
{
//root users are automatically resource admins:
if
(
ResourceManager
::
getGlobalResourcePermission
(
$user
)
===
'admin'
)
{
return
'admin'
;
}
...
...
@@ -2357,23 +2356,30 @@ class Resource extends SimpleORMap implements StudipItem
}
}
if
(
!
$perm_string
)
{
//A user which doesn't have special permissions for this resource
//can have global resource permissions:
$global_perm
=
ResourceManager
::
getGlobalResourcePermission
(
$user
);
if
(
$global_perm
)
{
//Set the permission cache:
if
(
!
is_array
(
self
::
$permission_cache
[
$this
->
id
]))
{
self
::
$permission_cache
[
$this
->
id
]
=
[];
}
self
::
$permission_cache
[
$this
->
id
][
$user
->
id
]
=
$global_perm
;
}
$perm_string
=
$global_perm
;
}
//Now we must check for global resource locks:
if
(
GlobalResourceLock
::
currentlyLocked
())
{
//The resource management system is currently locked.
//We must either return 'admin' for users with that
//permission level or 'user' for all other permission
//permission level 'user' for all other permission
//levels.
if
(
$perm_string
==
'admin'
)
{
return
'admin'
;
}
elseif
(
$perm_string
)
{
if
(
$perm_string
)
{
//A permission level exists for the user.
//The user gets "user" permissions in case
//a global lock is active.
return
'user'
;
}
else
{
//No permission level exists for the user.
return
''
;
$perm_string
=
'user'
;
}
}
...
...
@@ -2383,17 +2389,7 @@ class Resource extends SimpleORMap implements StudipItem
return
$perm_string
;
}
//A user which doesn't have special permissions for this resource
//can have global resource permissions:
$global_perm
=
ResourceManager
::
getGlobalResourcePermission
(
$user
);
if
(
$global_perm
)
{
//Set the permission cache:
if
(
!
is_array
(
self
::
$permission_cache
[
$this
->
id
]))
{
self
::
$permission_cache
[
$this
->
id
]
=
[];
}
self
::
$permission_cache
[
$this
->
id
][
$user
->
id
]
=
$global_perm
;
}
return
$global_perm
;
}
/**
...
...
@@ -2417,8 +2413,8 @@ class Resource extends SimpleORMap implements StudipItem
return
false
;
}
if
(
$user
->
perms
==
'root'
)
{
//root users have all permissions for the resource.
if
(
ResourceManager
::
getGlobalResourcePermission
(
$user
)
===
'admin'
)
{
return
true
;
}
...
...
@@ -2435,7 +2431,7 @@ class Resource extends SimpleORMap implements StudipItem
return
false
;
}
}
elseif
(
$permission
===
'autor'
)
{
if
(
$perm_level
!=
'admin'
&&
GlobalResourceLock
::
currentlyLocked
())
{
if
(
GlobalResourceLock
::
currentlyLocked
())
{
//A global resource lock means no writing actions are permitted.
return
false
;
}
...
...
@@ -2445,7 +2441,7 @@ class Resource extends SimpleORMap implements StudipItem
return
false
;
}
}
elseif
(
$permission
===
'tutor'
)
{
if
(
$perm_level
!=
'admin'
&&
GlobalResourceLock
::
currentlyLocked
())
{
if
(
GlobalResourceLock
::
currentlyLocked
())
{
//A global resource lock means no writing actions are permitted.
return
false
;
}
...
...
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