예제 #1
0
        public OguRoleCollection GetAppRoles(string codeName)
        {
            ApplicationCollection apps = PermissionMechanismFactory.GetMechanism().GetApplications(codeName);

            OguRoleCollection roles = new OguRoleCollection();

            if (apps.Count > 0)
            {
                roles.CopyFrom(apps[0].Roles);
            }

            return(roles);
        }
예제 #2
0
		public void OguRoleCollectionSerializationTest()
		{
			JSONSerializerExecute.RegisterConverter(typeof(OguApplicationConverter));
			JSONSerializerExecute.RegisterConverter(typeof(OguRoleConverter));

			IRole[] testRoles = DeluxePrincipal.GetRoles(RolesDefineConfig.GetConfig().RolesDefineCollection["testRole"].Roles);

			OguRoleCollection roles = new OguRoleCollection(testRoles);

			string serializedData = JSONSerializerExecute.Serialize(roles);

			Console.WriteLine(serializedData);

			OguRoleCollection deserializedData = JSONSerializerExecute.Deserialize<OguRoleCollection>(serializedData);

			for (int i = 0; i < roles.Count; i++)
				ValidatePermissionObject(roles[i], deserializedData[i]);
		}
예제 #3
0
        protected override void OnDialogContentControlLoaded(Control container)
        {
            base.OnDialogContentControlLoaded(container);

            if (string.IsNullOrEmpty(this.DialogTitle))
            {
                this.DialogTitle = RoleGraphControlParams.DefaultDialogTitle;
            }

            this._ApplicationSelector = (HtmlSelect)container.FindControl("applications");
            this._RoleSelector        = (HtmlSelect)container.FindControl("roles");
            this._LoadingTag          = (HtmlGenericControl)container.FindControl("loadingTag");
            this._RelativeLink        = (HtmlAnchor)container.FindControl("relativeLink");

            HtmlGenericControl img = (HtmlGenericControl)container.FindControl("loadingImg");

            if (img != null)
            {
                img.Style["background-image"] = string.Format("url({0})", ControlResources.HourglassLogoUrl);
            }

            OguApplicationCollection apps = new OguApplicationCollection(PermissionMechanismFactory.GetMechanism().GetAllApplications());

            this._ApplicationsData = apps;

            if (apps.Count > 0)
            {
                string appCodeName = GetAppCodeNameFromFullCodeName(this.SelectedFullCodeName);

                IApplication selectedApp = null;

                if (string.IsNullOrEmpty(appCodeName) == false)
                {
                    selectedApp = apps.Find(app => app.CodeName == appCodeName);
                }

                if (selectedApp == null)
                {
                    selectedApp = apps[0];
                }

                this._RolesData = new OguRoleCollection(selectedApp.Roles);
            }
        }
예제 #4
0
        public void OguRoleCollectionSerializationTest()
        {
            JSONSerializerExecute.RegisterConverter(typeof(OguApplicationConverter));
            JSONSerializerExecute.RegisterConverter(typeof(OguRoleConverter));

            IRole[] testRoles = DeluxePrincipal.GetRoles(RolesDefineConfig.GetConfig().RolesDefineCollection["testRole"].Roles);

            OguRoleCollection roles = new OguRoleCollection(testRoles);

            string serializedData = JSONSerializerExecute.Serialize(roles);

            Console.WriteLine(serializedData);

            OguRoleCollection deserializedData = JSONSerializerExecute.Deserialize <OguRoleCollection>(serializedData);

            for (int i = 0; i < roles.Count; i++)
            {
                ValidatePermissionObject(roles[i], deserializedData[i]);
            }
        }
예제 #5
0
        protected override void OnDialogContentControlLoaded(Control container)
        {
            base.OnDialogContentControlLoaded(container);

            if (string.IsNullOrEmpty(this.DialogTitle))
                this.DialogTitle = RoleGraphControlParams.DefaultDialogTitle;

            this._ApplicationSelector = (HtmlSelect)container.FindControl("applications");
            this._RoleSelector = (HtmlSelect)container.FindControl("roles");
            this._LoadingTag = (HtmlGenericControl)container.FindControl("loadingTag");
            this._RelativeLink = (HtmlAnchor)container.FindControl("relativeLink");

            HtmlGenericControl img = (HtmlGenericControl)container.FindControl("loadingImg");

            if (img != null)
                img.Style["background-image"] = string.Format("url({0})", ControlResources.HourglassLogoUrl);

            OguApplicationCollection apps = new OguApplicationCollection(PermissionMechanismFactory.GetMechanism().GetAllApplications());

            this._ApplicationsData = apps;

            if (apps.Count > 0)
            {
                string appCodeName = GetAppCodeNameFromFullCodeName(this.SelectedFullCodeName);

                IApplication selectedApp = null;

                if (string.IsNullOrEmpty(appCodeName) == false)
                    selectedApp = apps.Find(app => app.CodeName == appCodeName);

                if (selectedApp == null)
                    selectedApp = apps[0];

                this._RolesData = new OguRoleCollection(selectedApp.Roles);
            }
        }
예제 #6
0
        public OguRoleCollection GetAppRoles(string codeName)
        {
            ApplicationCollection apps = PermissionMechanismFactory.GetMechanism().GetApplications(codeName);

            OguRoleCollection roles = new OguRoleCollection();

            if (apps.Count > 0)
                roles.CopyFrom(apps[0].Roles);

            return roles;
        }