public WebAuthorityDataType GetAuthorityDataType(Boolean refresh)
 {
     if (_authorityDataType.IsNull() || refresh)
     {
         _authorityDataType = ArtDatabanken.WebService.UserService.Data.UserManager.GetAuthorityDataTypes(GetContext())[0];
     }
     return(_authorityDataType);
 }
 private WebAuthorityDataType GetAuthorityDataType()
 {
     if (_authorityDataType.IsNull())
     {
         _authorityDataType = new WebAuthorityDataType();
     }
     return(_authorityDataType);
 }
        public void Constructor()
        {
            WebAuthorityDataType authorityType;

            authorityType = new WebAuthorityDataType();

            Assert.IsNotNull(authorityType);
        }
        /// <summary>
        /// Get WebAuthority from Authority.
        /// </summary>
        /// <param name="userContext">User context.</param>
        /// <param name="authority">Authority.</param>
        /// <returns>WebAuthority.</returns>
        public WebAuthority GetAuthority(IUserContext userContext,
                                         IAuthority authority)
        {
            WebAuthority webAuthority;

            webAuthority = new WebAuthority();

            webAuthority.ActionGUIDs   = authority.ActionGUIDs;
            webAuthority.FactorGUIDs   = authority.FactorGUIDs;
            webAuthority.LocalityGUIDs = authority.LocalityGUIDs;
            webAuthority.ProjectGUIDs  = authority.ProjectGUIDs;
            webAuthority.RegionGUIDs   = authority.RegionGUIDs;
            webAuthority.TaxonGUIDs    = authority.TaxonGUIDs;

            webAuthority.ReadPermission   = authority.ReadPermission;
            webAuthority.CreatePermission = authority.CreatePermission;
            webAuthority.UpdatePermission = authority.UpdatePermission;
            webAuthority.DeletePermission = authority.DeletePermission;

            webAuthority.MaxProtectionLevel = authority.MaxProtectionLevel;
            webAuthority.ShowNonPublicData  = authority.ReadNonPublicPermission;

            webAuthority.RoleId = authority.RoleId;

            if (authority.AdministrationRoleId.HasValue)
            {
                webAuthority.AdministrationRoleId = authority.AdministrationRoleId.Value;
            }
            webAuthority.Identifier  = authority.Identifier;
            webAuthority.CreatedBy   = authority.UpdateInformation.CreatedBy;
            webAuthority.CreatedDate = authority.UpdateInformation.CreatedDate;
            webAuthority.Description = authority.Description;
            webAuthority.GUID        = authority.GUID;
            webAuthority.Id          = authority.Id;
            webAuthority.IsAdministrationRoleIdSpecified = authority.AdministrationRoleId.HasValue;
            webAuthority.ModifiedBy    = authority.UpdateInformation.ModifiedBy;
            webAuthority.ModifiedDate  = authority.UpdateInformation.ModifiedDate;
            webAuthority.Name          = authority.Name;
            webAuthority.Obligation    = authority.Obligation;
            webAuthority.ValidFromDate = authority.ValidFromDate;
            webAuthority.ValidToDate   = authority.ValidToDate;
            webAuthority.AuthorityType = authority.AuthorityType;
            // If authority is of type data type the id and identifier must be set,
            // otherwise the autority is associated with an application.
            // if(authority.AuthorityType.Equals(AuthorityType.DataType))
            if (authority.AuthorityDataType.IsNotNull())
            {
                WebAuthorityDataType webAuthorityDataType = new WebAuthorityDataType();
                webAuthorityDataType.Id         = authority.AuthorityDataType.Id;
                webAuthorityDataType.Identifier = authority.AuthorityDataType.Identifier;
                webAuthority.AuthorityDataType  = webAuthorityDataType;
            }
            else
            {
                webAuthority.ApplicationId = authority.ApplicationId;
            }
            return(webAuthority);
        }
        public void AuthorityDataType()
        {
            Assert.IsNull(GetAuthority().AuthorityDataType);
            WebAuthorityDataType authorityDataType = new WebAuthorityDataType();

            authorityDataType.Id                 = 3;
            authorityDataType.Identifier         = "AuthorityDataTypeIdentifier";
            GetAuthority(true).AuthorityDataType = authorityDataType;
            Assert.AreEqual(authorityDataType.Id, GetAuthority().AuthorityDataType.Id);
            Assert.AreEqual(authorityDataType.Identifier, GetAuthority().AuthorityDataType.Identifier);
        }
Example #6
0
 /// <summary>
 /// Load data from data reader into the WebAuthorityDataType instance.
 /// </summary>
 /// <param name="authorityDataType">This authority data type.</param>
 /// <param name='dataReader'>An open data reader.</param>
 public static void LoadData(this WebAuthorityDataType authorityDataType,
                             DataReader dataReader)
 {
     authorityDataType.Id         = dataReader.GetInt32(AuthorityDataType.ID);
     authorityDataType.Identifier = dataReader.GetString(AuthorityDataType.AUTHORITY_DATA_TYPE_IDENTITY);
 }
 public WebAuthorityDataTypeExtensionTest()
 {
     _authorityDataType = null;
 }
 public WebAuthorityDataTypeTest()
 {
     _authorityDataType = null;
 }