Skip to content

Commit

Permalink
TRUNK-4049 Daemon cannot assing System Developer role
Browse files Browse the repository at this point in the history
(cherry picked from commit e8dca61)
  • Loading branch information
rkorytkowski committed Aug 20, 2013
1 parent 0959396 commit 0d029be
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
4 changes: 3 additions & 1 deletion api/src/main/java/org/openmrs/api/impl/UserServiceImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
import org.openmrs.api.db.DAOException;
import org.openmrs.api.db.UserDAO;
import org.openmrs.patient.impl.LuhnIdentifierValidator;
import org.openmrs.util.OpenmrsConstants;
import org.openmrs.util.OpenmrsUtil;
import org.openmrs.util.PrivilegeConstants;
import org.openmrs.util.RoleConstants;
Expand Down Expand Up @@ -448,7 +449,8 @@ private void checkPrivileges(User user) {
List<String> requiredPrivs = new Vector<String>();

for (Role r : roles) {
if (r.getRole().equals(RoleConstants.SUPERUSER) && !authUser.hasRole(RoleConstants.SUPERUSER))
if (r.getRole().equals(RoleConstants.SUPERUSER)
&& !Context.hasPrivilege(PrivilegeConstants.ASSIGN_SYSTEM_DEVELOPER_ROLE))
throw new APIException("You must have the role '" + RoleConstants.SUPERUSER + "' in order to assign it.");
if (r.getPrivileges() != null) {
for (Privilege p : r.getPrivileges())
Expand Down
3 changes: 3 additions & 0 deletions api/src/main/java/org/openmrs/util/PrivilegeConstants.java
Original file line number Diff line number Diff line change
Expand Up @@ -873,4 +873,7 @@ public class PrivilegeConstants {

@AddOnStartup(description = "Able to add/edit/retire encounter roles")
public static final String MANAGE_ENCOUNTER_ROLES = "Manage Encounter Roles";

@AddOnStartup(description = "Able to assign System Developer role")
public static final String ASSIGN_SYSTEM_DEVELOPER_ROLE = "Assign System Developer Role";
}

0 comments on commit 0d029be

Please sign in to comment.