Пример #1
0
        public Permission CreatePermission(string name, ILocalizableString displayName, bool isGrantedByDefault = false, ILocalizableString description = null)
        {
            if (_permissions.ContainsKey(name))
            {
                throw new AbpException("There is already a permission with name: " + name);
            }

            var permission = new Permission(name, displayName, isGrantedByDefault, description);

            _permissions[permission.Name] = permission;
            return(permission);
        }
Пример #2
0
        public Permission CreatePermission(string name, ILocalizableString displayName = null, bool isGrantedByDefault = false, ILocalizableString description = null, MultiTenancySides multiTenancySides = MultiTenancySides.Host | MultiTenancySides.Tenant)
        {
            if (Permissions.ContainsKey(name))
            {
                throw new AbpException("There is already a permission with name: " + name);
            }

            var permission = new Permission(name, displayName, isGrantedByDefault, description, multiTenancySides);

            Permissions[permission.Name] = permission;
            return(permission);
        }
Пример #3
0
        /// <summary>
        /// 创建权限,并将权限添加到权限字典中
        /// 返回新建的权限
        /// </summary>
        /// <param name="name"></param>
        /// <param name="displayName"></param>
        /// <param name="description"></param>
        /// <param name="multiTenancySides"></param>
        /// <param name="featureDependency"></param>
        /// <returns></returns>
        public Permission CreatePermission(
            string name,
            ILocalizableString displayName       = null,
            ILocalizableString description       = null,
            MultiTenancySides multiTenancySides  = MultiTenancySides.Host | MultiTenancySides.Tenant,
            IFeatureDependency featureDependency = null)
        {
            if (Permissions.ContainsKey(name))
            {
                throw new AbpException("There is already a permission with name: " + name);
            }

            var permission = new Permission(name, displayName, description, multiTenancySides, featureDependency);

            Permissions[permission.Name] = permission;
            return(permission);
        }