*/
package org.sonar.ce.user;
-import java.util.Collection;
import java.util.List;
import java.util.Set;
import org.sonar.db.user.GroupDto;
return notImplemented();
}
- @Override
- public boolean hasGlobalPermission(String globalPermission) {
- return notImplementedBooleanMethod();
- }
-
@Override
public List<String> globalPermissions() {
return notImplemented();
return isRoot() || globalPermissions().contains(globalPermission);
}
- @Override
- public boolean hasGlobalPermission(String globalPermission) {
- return isRoot() || hasPermission(globalPermission);
- }
-
@Override
public UserSession checkComponentPermission(String projectPermission, String componentKey) {
if (!hasComponentPermission(projectPermission, componentKey)) {
return get().hasPermission(globalPermission);
}
- @Override
- public boolean hasGlobalPermission(String globalPermission) {
- return get().hasGlobalPermission(globalPermission);
- }
-
@Override
public List<String> globalPermissions() {
return get().globalPermissions();
*/
UserSession checkOrganizationPermission(String organizationUuid, String permission);
- /**
- * @deprecated Only used by Views and the Developer Cockpit plugins.
- */
- @Deprecated
- boolean hasGlobalPermission(String globalPermission);
-
List<String> globalPermissions();
/**
return currentUserSession.hasPermission(globalPermission);
}
- @Override
- public boolean hasGlobalPermission(String globalPermission) {
- return currentUserSession.hasGlobalPermission(globalPermission);
- }
-
@Override
public boolean hasOrganizationPermission(String organizationUuid, String permission) {
return currentUserSession.hasOrganizationPermission(organizationUuid, permission);
session.checkComponentUuidPermission(UserRole.USER, "another-uuid");
}
- @Test
- public void deprecated_has_global_permission() throws Exception {
- addGlobalPermissions("profileadmin", "admin");
- UserSession session = newUserSession(userDto);
-
- assertThat(session.hasGlobalPermission(QUALITY_PROFILE_ADMIN)).isTrue();
- assertThat(session.hasGlobalPermission(SYSTEM_ADMIN)).isTrue();
- assertThat(session.hasGlobalPermission(QUALITY_GATE_ADMIN)).isFalse();
- }
-
@Test
public void fail_if_user_dto_is_null() throws Exception {
expectedException.expect(NullPointerException.class);