public PermissionCollection GetPermissions(IApplication application) { application.NullCheck("application"); DataTable table = AppAdminServiceBroker.Instance.GetFunctions(application.CodeName, RightMaskType.App).Tables[0]; PermissionCollection permissions = new PermissionCollection(BuildObjectsFromTable <IPermission>(table)); foreach (PermissionImpl permission in permissions) { permission.Application = application; } return(permissions); }
private PermissionCollection GetUserAppPermissions(IApplication app) { PermissionCollection permissions = null; lock (userAppPermissions) { if (userAppPermissions.TryGetValue(app, out permissions) == false) { permissions = OguPermissionSettings.GetConfig().PermissionObjectImpls.GetUserPermissions(app, User); userAppPermissions.Add(app, permissions); } } return(permissions); }
/// <summary> /// 得到所有应用的权限集合 /// </summary> /// <returns></returns> public Dictionary <IApplication, PermissionCollection> GetAllAppPermissions() { ApplicationCollection allApps = OguPermissionSettings.GetConfig().PermissionFactory.GetAllApplications(); lock (this.userAppPermissions) { foreach (IApplication app in allApps) { if (this.userAppPermissions.ContainsKey(app) == false) { PermissionCollection permissions = OguPermissionSettings.GetConfig().PermissionObjectImpls.GetUserPermissions(app, User); this.userAppPermissions.Add(app, permissions); } } } return(this.userAppPermissions); }
public PermissionCollection GetUserPermissions(IApplication application, IUser user) { application.NullCheck("application"); user.NullCheck("user"); DataTable table = AppAdminServiceBroker.Instance.GetUserPermissions( user.ID, application.CodeName, UserValueType.Guid, RightMaskType.App, DelegationMaskType.All).Tables[0]; PermissionCollection permissions = new PermissionCollection(BuildObjectsFromTable <IPermission>(table)); foreach (PermissionImpl permission in permissions) { permission.Application = application; } return(permissions); }