/// <summary> /// Removes a role from the data source for the configured application Name /// </summary> /// <param name="roleName">The role to delete</param> /// <param name="throwOnPopulatedRole">If true, throw an exception if roleName has one or more members and do not delete roleName.</param> /// <returns><b>true</b> if role is deleted <b>false</b> otherwise</returns> public override bool DeleteRole(string roleName, bool throwOnPopulatedRole) { Role role = RoleDataSource.LoadForRolename(roleName); if (role == null) { return(false); } return(role.Delete()); }
/// <summary> /// Makes sure that the default roles expected for a store are available /// in the database /// </summary> internal static void EnsureDefaultRoles() { string[] defaultRoles = Role.AllAdminRoles; //make sure the admin role exists foreach (string roleName in defaultRoles) { Role role = RoleDataSource.LoadForRolename(roleName); if (role == null) { role = new Role(); role.Name = roleName; role.Save(); } } }