コード例 #1
0
        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);
        }
コード例 #2
0
        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);
        }
コード例 #3
0
        /// <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);
        }
コード例 #4
0
        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);
        }