package com.atlassian.bitbucket.web.conditions;

import com.atlassian.bitbucket.permission.PermissionService;
import com.atlassian.bitbucket.user.UserAdminService;

/**
 * Verifies that is is possible to create users.
 */
public class CanCreateUsersCondition extends AbstractUserManagementPermissionCondition {

    public CanCreateUsersCondition(UserAdminService adminService, PermissionService permissionService) {
        super(adminService, permissionService);
    }

    /**
     * Performs a check to determine whether the creation of new users is allowed.
     *
     * @param adminService the service to use when performing the check
     * @return {@link UserAdminService#canCreateUsers()}
     */
    @Override
    public boolean shouldDisplay(UserAdminService adminService) {
        return adminService.canCreateUsers();
    }
}
