예제 #1
0
        private string GetPackagePolicy(string settingsName, string key)
        {
            // load package
            PackageInfo package = PackagesHelper.GetCachedPackage(PanelSecurity.PackageId);

            if (package != null)
            {
                // load user profile
                int userId = package.UserId;
                _policyUser = UsersHelper.GetCachedUser(package.UserId);

                if (_policyUser != null)
                {
                    // load settings
                    UserSettings settings = UsersHelper.GetCachedUserSettings(userId, settingsName);
                    if (settings != null)
                    {
                        string policyValue = settings[key];
                        if (policyValue != null)
                        {
                            return(policyValue);
                        }
                    }
                }
            }

            return(null);
        }
예제 #2
0
        public void SetPackagePolicy(int packageId, string settingsName, string key)
        {
            // load package
            PackageInfo package = PackagesHelper.GetCachedPackage(packageId);

            if (package != null)
            {
                // init by user
                SetUserPolicy(package.UserId, settingsName, key);
            }
        }