public List <User> getUsers(string groupId) { string sql = SecurityDataScripts.GetUserListSQL(groupId); DataTable tb = SecuritySettings.Execute(sql); List <User> ret = new List <User>(); foreach (DataRow r in tb.Rows) { User user = new User(); user.Id = r["user_id"].ToString(); user.DisplayName = r["display_name"].ToString(); if (string.IsNullOrEmpty(user.DisplayName)) { user.DisplayName = user.Id; } user.CreateDate = r["create_date"].ToString(); user.Password = ""; user.IsDisable = r["disabled"] is System.DBNull ? false : (bool)r["disabled"]; user.IsActive = r["actived"] is System.DBNull ? false : (bool)r["actived"]; user.Email = r["bind_email"].ToString(); user.Mobile = r["bind_mobile"].ToString(); user.GroupId = r["group_id"].ToString(); ret.Add(user); } return(ret); }
public bool deletePermission(string roleId, string objectType, string objectId) { string sql = SecurityDataScripts.DeleteRolePermissionSQL(roleId, objectType, objectId); SecuritySettings.ExecuteNonQuery(sql); return(true); }
public bool existsRole(string roleId) { string sql = SecurityDataScripts.CheckRoleExistsSQL(roleId); object roleObj = SecuritySettings.ExecuteScalar(sql); return(!(roleObj == null)); }
public static bool savePermissions(RolePermisssions rolePermissions) { List <PermissionObject> permissions = rolePermissions.PermissionObjList; string roleId = rolePermissions.RoleId; bool ret = false; for (int i = 0; i < permissions.Count; i++) { PermissionObject po = permissions[i]; string sql = SecurityDataScripts.SavePermissionSql(roleId, po.ObjectType, po.ObjectId, po.Permission); SecuritySettings.ExecuteNonQuery(sql); } ret = true; return(ret); }
public static List <Role> getUserRoles(string userId) { string sql = SecurityDataScripts.GetUserRoleListSQL(userId); DataTable tb = SecuritySettings.Execute(sql); List <Role> ret = new List <Role>(); foreach (DataRow r in tb.Rows) { Role role = new Role(); role.Id = r["role_id"].ToString(); role.DisplayName = r["display_name"].ToString(); role.Remark = r["remark"].ToString(); ret.Add(role); } return(ret); }