mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-10 15:35:49 +01:00
removes admin flag from user object
This commit is contained in:
@@ -157,12 +157,6 @@ public class User extends BasicPropertiesAware implements Principal, ModelObject
|
||||
{
|
||||
boolean result = false;
|
||||
|
||||
if (user.isAdmin() != admin)
|
||||
{
|
||||
result = true;
|
||||
user.setAdmin(admin);
|
||||
}
|
||||
|
||||
if (user.isActive() != active)
|
||||
{
|
||||
result = true;
|
||||
@@ -229,7 +223,6 @@ public class User extends BasicPropertiesAware implements Principal, ModelObject
|
||||
&& Objects.equal(displayName, other.displayName)
|
||||
&& Objects.equal(mail, other.mail)
|
||||
&& Objects.equal(type, other.type)
|
||||
&& Objects.equal(admin, other.admin)
|
||||
&& Objects.equal(active, other.active)
|
||||
&& Objects.equal(password, other.password)
|
||||
&& Objects.equal(creationDate, other.creationDate)
|
||||
@@ -246,7 +239,7 @@ public class User extends BasicPropertiesAware implements Principal, ModelObject
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
return Objects.hashCode(name, displayName, mail, type, admin, password,
|
||||
return Objects.hashCode(name, displayName, mail, type, password,
|
||||
active, creationDate, lastModified, properties);
|
||||
}
|
||||
|
||||
@@ -269,7 +262,6 @@ public class User extends BasicPropertiesAware implements Principal, ModelObject
|
||||
.add("displayName",displayName)
|
||||
.add("mail", mail)
|
||||
.add("password", pwd)
|
||||
.add("admin", admin)
|
||||
.add("type", type)
|
||||
.add("active", active)
|
||||
.add("creationDate", creationDate)
|
||||
@@ -385,17 +377,6 @@ public class User extends BasicPropertiesAware implements Principal, ModelObject
|
||||
return active;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public boolean isAdmin()
|
||||
{
|
||||
return admin;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
@@ -424,17 +405,6 @@ public class User extends BasicPropertiesAware implements Principal, ModelObject
|
||||
this.active = active;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param admin
|
||||
*/
|
||||
public void setAdmin(boolean admin)
|
||||
{
|
||||
this.admin = admin;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
@@ -518,9 +488,6 @@ public class User extends BasicPropertiesAware implements Principal, ModelObject
|
||||
/** Field description */
|
||||
private boolean active = true;
|
||||
|
||||
/** Field description */
|
||||
private boolean admin = false;
|
||||
|
||||
/** Field description */
|
||||
private Long creationDate;
|
||||
|
||||
|
||||
@@ -6,7 +6,6 @@ export type User = {
|
||||
name: string,
|
||||
mail: string,
|
||||
password: string,
|
||||
admin: boolean,
|
||||
active: boolean,
|
||||
type?: string,
|
||||
creationDate?: string,
|
||||
|
||||
@@ -37,7 +37,6 @@ class UserForm extends React.Component<Props, State> {
|
||||
displayName: "",
|
||||
mail: "",
|
||||
password: "",
|
||||
admin: false,
|
||||
active: true,
|
||||
_links: {}
|
||||
},
|
||||
@@ -167,12 +166,6 @@ class UserForm extends React.Component<Props, State> {
|
||||
<div className="columns">
|
||||
<div className="column">
|
||||
{passwordChangeField}
|
||||
<Checkbox
|
||||
label={t("user.admin")}
|
||||
onChange={this.handleAdminChange}
|
||||
checked={user ? user.admin : false}
|
||||
helpText={t("help.adminHelpText")}
|
||||
/>
|
||||
<Checkbox
|
||||
label={t("user.active")}
|
||||
onChange={this.handleActiveChange}
|
||||
@@ -225,10 +218,6 @@ class UserForm extends React.Component<Props, State> {
|
||||
});
|
||||
};
|
||||
|
||||
handleAdminChange = (admin: boolean) => {
|
||||
this.setState({ user: { ...this.state.user, admin } });
|
||||
};
|
||||
|
||||
handleActiveChange = (active: boolean) => {
|
||||
this.setState({ user: { ...this.state.user, active } });
|
||||
};
|
||||
|
||||
@@ -29,12 +29,6 @@ class Details extends React.Component<Props> {
|
||||
<MailLink address={user.mail} />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td className="has-text-weight-semibold">{t("user.admin")}</td>
|
||||
<td>
|
||||
<Checkbox checked={user.admin} />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td className="has-text-weight-semibold">{t("user.active")}</td>
|
||||
<td>
|
||||
|
||||
@@ -23,7 +23,7 @@ export default class UserRow extends React.Component<Props> {
|
||||
<a href={`mailto: ${user.mail}`}>{user.mail}</a>
|
||||
</td>
|
||||
<td className="is-hidden-mobile">
|
||||
<input type="checkbox" id="admin" checked={user.admin} readOnly />
|
||||
<input type="checkbox" id="active" checked={user.active} readOnly />
|
||||
</td>
|
||||
</tr>
|
||||
);
|
||||
|
||||
@@ -21,7 +21,7 @@ class UserTable extends React.Component<Props> {
|
||||
<th className="is-hidden-mobile">{t("user.name")}</th>
|
||||
<th>{t("user.displayName")}</th>
|
||||
<th>{t("user.mail")}</th>
|
||||
<th className="is-hidden-mobile">{t("user.admin")}</th>
|
||||
<th className="is-hidden-mobile">{t("user.active")}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
@@ -121,7 +121,7 @@ public class AuthorizationChangedEventProducer {
|
||||
}
|
||||
|
||||
private boolean isAuthorizationDataModified(User user, User beforeModification) {
|
||||
return user.isAdmin() != beforeModification.isAdmin() || user.isActive() != beforeModification.isActive();
|
||||
return user.isActive() != beforeModification.isActive();
|
||||
}
|
||||
|
||||
private void fireEventForUser(String username) {
|
||||
|
||||
@@ -271,11 +271,6 @@ public class DefaultAuthorizationCollector implements AuthorizationCollector
|
||||
}
|
||||
|
||||
private boolean isAdmin(User user, GroupNames groups) {
|
||||
boolean admin = user.isAdmin();
|
||||
if (admin) {
|
||||
logger.debug("user {} is marked as admin, because of the user flag", user.getName());
|
||||
return true;
|
||||
}
|
||||
if (isUserAdminInConfiguration(user)) {
|
||||
logger.debug("user {} is marked as admin, because of the admin user configuration", user.getName());
|
||||
return true;
|
||||
|
||||
@@ -142,7 +142,6 @@ public class GitLfsITCase {
|
||||
dto.setDisplayName(user.getDisplayName());
|
||||
dto.setType(user.getType());
|
||||
dto.setActive(user.isActive());
|
||||
dto.setAdmin(user.isAdmin());
|
||||
dto.setPassword(user.getPassword());
|
||||
createResource(adminClient, "users")
|
||||
.accept("*/*")
|
||||
|
||||
@@ -133,7 +133,6 @@ public class UserPermissionITCase extends AbstractPermissionITCaseBase<User>
|
||||
"scm-admin@scm-manager.org");
|
||||
|
||||
user.setPassword("hallo123");
|
||||
user.setAdmin(true);
|
||||
user.setType("xml");
|
||||
|
||||
return user;
|
||||
|
||||
@@ -115,7 +115,7 @@ public class AuthorizationChangedEventProducerTest {
|
||||
producer.onEvent(new UserModificationEvent(HandlerEventType.CREATE, userModified, user));
|
||||
assertEventIsNotFired();
|
||||
|
||||
userModified.setAdmin(true);
|
||||
userModified.setActive(false);
|
||||
|
||||
producer.onEvent(new UserModificationEvent(HandlerEventType.BEFORE_CREATE, userModified, user));
|
||||
assertEventIsNotFired();
|
||||
|
||||
@@ -197,22 +197,6 @@ public class DefaultAuthorizationCollectorTest {
|
||||
assertThat(authInfo.getObjectPermissions(), nullValue());
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests {@link AuthorizationCollector#collect()} as admin.
|
||||
*/
|
||||
@Test
|
||||
@SubjectAware(
|
||||
configuration = "classpath:sonia/scm/shiro-001.ini"
|
||||
)
|
||||
public void testCollectAsAdmin() {
|
||||
User trillian = UserTestData.createTrillian();
|
||||
trillian.setAdmin(true);
|
||||
authenticate(trillian, "main");
|
||||
|
||||
AuthorizationInfo authInfo = collector.collect();
|
||||
assertIsAdmin(authInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests {@link AuthorizationCollector#collect()} with repository permissions.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user