return notImplemented();
}
- @Override
- public UserSession checkAnyPermissions(Collection<String> globalPermissions) {
- return notImplemented();
- }
-
@Override
public boolean hasPermission(String globalPermission) {
return notImplementedBooleanMethod();
*/
package org.sonar.server.user;
-import java.util.Collection;
-import java.util.List;
import org.sonar.server.exceptions.ForbiddenException;
import org.sonar.server.exceptions.UnauthorizedException;
return this;
}
- @Override
- public UserSession checkAnyPermissions(Collection<String> globalPermissionsToTest) {
- List<String> userGlobalPermissions = globalPermissions();
- for (String userGlobalPermission : userGlobalPermissions) {
- if (globalPermissionsToTest.contains(userGlobalPermission)) {
- return this;
- }
- }
-
- throw new ForbiddenException(INSUFFICIENT_PRIVILEGES_MESSAGE);
- }
-
@Override
public boolean hasPermission(String globalPermission) {
return isRoot() || globalPermissions().contains(globalPermission);
*/
package org.sonar.server.user;
-import java.util.Collection;
import java.util.List;
import java.util.Set;
import javax.annotation.CheckForNull;
return this;
}
- @Override
- public UserSession checkAnyPermissions(Collection<String> globalPermissions) {
- get().checkAnyPermissions(globalPermissions);
- return this;
- }
-
@Override
public boolean hasPermission(String globalPermission) {
return get().hasPermission(globalPermission);
*/
package org.sonar.server.user;
-import java.util.Collection;
import java.util.List;
import java.util.Set;
import javax.annotation.CheckForNull;
/**
* Ensures that permission is granted to user, otherwise throws a {@link org.sonar.server.exceptions.ForbiddenException}.
+
* @deprecated in 6.3 because it doesn't support organizations
- *
+ * @see org.sonar.core.permission.GlobalPermissions
* @see #checkIsRoot() for system administrators
* @see #checkOrganizationPermission(String, String) for organization members
*/
@Deprecated
UserSession checkPermission(String globalPermission);
- /**
- * Ensures that at least one of the global permissions is granted to user. If none are granted,
- * then throws a {@link org.sonar.server.exceptions.ForbiddenException}.
- */
- UserSession checkAnyPermissions(Collection<String> globalPermissions);
-
/**
* Does the user have the given permission ?
+
+ * @deprecated in 6.3 because if doesn't support organizations
+ * @see org.sonar.core.permission.GlobalPermissions
+ * @see #isRoot()
+ * @see #hasOrganizationPermission(String, String)
*/
+ @Deprecated
boolean hasPermission(String globalPermission);
/**
package org.sonar.server.tester;
import com.google.common.base.Preconditions;
-import java.util.Collection;
import java.util.List;
import java.util.Set;
import javax.annotation.CheckForNull;
return this;
}
- @Override
- public UserSession checkAnyPermissions(Collection<String> globalPermissions) {
- currentUserSession.checkAnyPermissions(globalPermissions);
- return this;
- }
-
@Override
public boolean hasPermission(String globalPermission) {
return currentUserSession.hasPermission(globalPermission);