mirror of
https://github.com/scm-manager/scm-manager.git
synced 2026-05-07 11:16:59 +02:00
remove checks for user type since it is deprecated now
This commit is contained in:
@@ -67,6 +67,12 @@ public class User extends BasicPropertiesAware implements Principal, ModelObject
|
||||
private String mail;
|
||||
private String name;
|
||||
private String password;
|
||||
@Deprecated
|
||||
/**
|
||||
* @deprecated Use external instead.
|
||||
* The user type is replaced by {@link external} flag
|
||||
* Since 2.8.0
|
||||
*/
|
||||
private String type;
|
||||
|
||||
public User(String name) {
|
||||
|
||||
@@ -128,8 +128,8 @@ class UserForm extends React.Component<Props, State> {
|
||||
const { user, passwordValid } = this.state;
|
||||
event.preventDefault();
|
||||
if (!this.isInvalid()) {
|
||||
if (user.password && passwordValid) {
|
||||
setPassword((user._links.password as Link).href, user.password).catch();
|
||||
if (user.password && passwordValid && user._links?.password) {
|
||||
setPassword((user._links.password as Link).href, user.password).catch(error => this.setState({ error }));
|
||||
}
|
||||
this.props.submitForm(this.state.user);
|
||||
}
|
||||
@@ -177,10 +177,6 @@ class UserForm extends React.Component<Props, State> {
|
||||
subtitle = <Subtitle subtitle={t("userForm.subtitle")} />;
|
||||
}
|
||||
|
||||
if (error) {
|
||||
return <ErrorNotification error={error} />;
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
{subtitle}
|
||||
@@ -232,6 +228,7 @@ class UserForm extends React.Component<Props, State> {
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
{error && <ErrorNotification error={error} />}
|
||||
<Level right={<SubmitButton disabled={this.isInvalid()} loading={loading} label={t("userForm.button")} />} />
|
||||
</form>
|
||||
</>
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
|
||||
package sonia.scm.api.v2.resources;
|
||||
|
||||
import de.otto.edison.hal.Embedded;
|
||||
@@ -66,9 +66,7 @@ public abstract class UserToUserDtoMapper extends BaseMapper<User, UserDto> {
|
||||
if (UserPermissions.modify(user).isPermitted()) {
|
||||
linksBuilder.single(link("update", resourceLinks.user().update(user.getName())));
|
||||
linksBuilder.single(link("publicKeys", resourceLinks.user().publicKeys(user.getName())));
|
||||
if (userManager.isTypeDefault(user)) {
|
||||
linksBuilder.single(link("password", resourceLinks.user().passwordChange(user.getName())));
|
||||
}
|
||||
linksBuilder.single(link("password", resourceLinks.user().passwordChange(user.getName())));
|
||||
}
|
||||
if (PermissionPermissions.read().isPermitted()) {
|
||||
linksBuilder.single(link("permissions", resourceLinks.userPermissions().permissions(user.getName())));
|
||||
|
||||
@@ -389,7 +389,7 @@ public class DefaultUserManager extends AbstractUserManager
|
||||
if (user == null) {
|
||||
throw new NotFoundException(User.class, userId);
|
||||
}
|
||||
if (!isTypeDefault(user) || isAnonymousUser(user)) {
|
||||
if (isAnonymousUser(user)) {
|
||||
throw new ChangePasswordNotAllowedException(ContextEntry.ContextBuilder.entity("PasswordChange", "-").in(User.class, user.getName()), user.getType());
|
||||
}
|
||||
user.setPassword(newPassword);
|
||||
|
||||
Reference in New Issue
Block a user