public NotificationBuilder addRestrictPermission(Permissions.Permission permission) { this.restrictPermissions.add(permission.getId()); return this; }
private Permissions.Permission getPermissionFromId() throws NumberFormatException { final Integer permissionId; try { permissionId = Integer.valueOf(id()); } catch (NumberFormatException e) { return null; } for (Permissions.Permission permission : Permissions.Permission.values()) { if (permissionId.equals(permission.getId())) { return permission; } } return null; }
public static PermissionJsonBean fullBean(Permissions.Permission permission) { return new PermissionJsonBean().id(String.valueOf(permission.getId())).key(permission.name()); } }
private UserPermissionJsonBean createBean(Permissions.Permission permission, Issue issue, Project project, ApplicationUser loggedInUser) { boolean hasPermission; if (issue != null) { hasPermission = permissionManager.hasPermission(new ProjectPermissionKey(permission.getId()), issue, loggedInUser); } else if (project != null) { hasPermission = permissionManager.hasPermission(new ProjectPermissionKey(permission.getId()), project, loggedInUser); } else { hasPermission = permissionManager.hasProjects(new ProjectPermissionKey(permission.getId()), loggedInUser); } return new UserPermissionJsonBean(permission, hasPermission, jiraAuthenticationContext); }
@Override public Integer apply(final String permission) { try { return Permissions.Permission.valueOf(permission).getId(); } catch (IllegalArgumentException e) { throw new RESTException(BAD_REQUEST, authContext.getI18nHelper().getText("rest.invalid.permission.string", permission)); } }
public UserPermissionJsonBean(Permissions.Permission permission, boolean havePermission, JiraAuthenticationContext authenticationContext) { id(String.valueOf(permission.getId())); key(permission.name()); this.type = PermissionType.PROJECT; this.name = authenticationContext.getI18nHelper().getText(permission.getNameKey()); this.description = authenticationContext.getI18nHelper().getText(permission.getDescriptionKey()); this.havePermission = havePermission; this.deprecatedKey = true; }