/// <summary> /// Get the user groups sharing policy. /// </summary> /// <param name="userID">The User ID</param> /// <returns> Returns the user groups sharing policy value </returns> public static int GetUserGroupSharingPolicy(string userID) { int groupSharing = 0; int retStatus = 0; UserPolicy userPolicy = null; Store store = Store.GetStore(); Domain domain = store.GetDomain(store.DefaultDomain); string[] GIDs = domain.GetMemberFamilyList(userID); foreach (string gid in GIDs) { if (gid != userID) { userPolicy = UserPolicy.GetPolicy(gid); groupSharing = userPolicy.SharingStatus; if ((groupSharing & (int)Share.EnforcedSharing) == (int)Share.EnforcedSharing) { return(groupSharing); } if (groupSharing >= (int)Share.Sharing && retStatus == 0) { retStatus = groupSharing; } } } return(retStatus); }
/// <summary> /// Get the User Groups Number of iFolder Policy value. /// </summary> /// <param name="userID">The User ID</param> /// <returns> 0 --> Allowed -1 -> Allready exceeding the limit -2 --> Groups policy not set , check systems </returns> public static int GetUserGroupiFolderLimitPolicy(string userID, long OwnediFolderCount) { int result = -2; UserPolicy user = null; Store store = Store.GetStore(); Domain domain = store.GetDomain(store.DefaultDomain); string[] GIDs = domain.GetMemberFamilyList(userID); foreach (string gid in GIDs) { if (gid != userID) { user = UserPolicy.GetPolicy(gid); if (user.NoiFoldersLimit != -1 && user.NoiFoldersLimit != -2) { if (user.NoiFoldersLimit <= OwnediFolderCount) { result = -1; } else { result = 0; } break; } } } return(result); }
public virtual int GetiFolderLimitPolicyStatus(string userID) { long userpolicy = 0, syspolicy = 0; UserPolicy user = null; SystemPolicy system = null; string accessID = null; if (userID == null) { accessID = GetAccessID(); //new iFolder } else { accessID = userID; // transfer of ownership } int result = 1; try { iFolderUserDetails userdetails = iFolderUserDetails.GetDetails(accessID); user = UserPolicy.GetPolicy(accessID); system = SystemPolicy.GetPolicy(); userpolicy = user.NoiFoldersLimit; syspolicy = system.NoiFoldersLimit; if (userpolicy != -1 && userpolicy != -2) { if (userpolicy <= userdetails.OwnediFolderCount) { result = 0; } } else { if (Simias.Service.Manager.LdapServiceEnabled == true) { int groupStatus = UserPolicy.GetUserGroupiFolderLimitPolicy(accessID, userdetails.OwnediFolderCount); if (groupStatus == 0) { return(result); } else if (groupStatus == -1) { result = 0; } } if (syspolicy <= userdetails.OwnediFolderCount && syspolicy != -1) { result = 0; } } return(result); } catch (Exception e) { SmartException.Throw(e); } return(result); }
public virtual UserPolicy GetAuthenticatedUserPolicy() { UserPolicy result = null; try { string accessID = GetAccessID(); result = UserPolicy.GetPolicy(accessID); } catch (Exception e) { SmartException.Throw(e); } return(result); }
public virtual int GetEncryptionPolicy() { UserPolicy user = null; SystemPolicy system = null; int SysEncrPolicy = 0, UserEncrPolicy = 0, securityStatus = 0; try { string accessID = GetAccessID(); user = UserPolicy.GetPolicy(accessID); system = SystemPolicy.GetPolicy(); UserEncrPolicy = user.EncryptionStatus; SysEncrPolicy = system.EncryptionStatus; int GroupEncrPolicy = UserPolicy.GetUserGroupEncryptionPolicy(accessID); securityStatus += DeriveStatus(SysEncrPolicy, GroupEncrPolicy, UserEncrPolicy, UserEncrPolicy); } catch (Exception e) { SmartException.Throw(e); } return(securityStatus); }
/// <summary> /// Get the user groups Encryption policy. /// </summary> /// <param name="userID">The User ID</param> /// <returns> Returns the user groups Encryption policy value </returns> public static int GetUserGroupEncryptionPolicy(string userID) { int groupEncryption = 0; UserPolicy userPolicy = null; Store store = Store.GetStore(); Domain domain = store.GetDomain(store.DefaultDomain); string[] GIDs = domain.GetMemberFamilyList(userID); foreach (string gid in GIDs) { if (gid != userID) { userPolicy = UserPolicy.GetPolicy(gid); groupEncryption = userPolicy.EncryptionStatus; if (groupEncryption != 0) { break; } } } return(groupEncryption); }
public virtual bool GetSharingPolicy(string iFolderID) { //return base.GetDisableSharingPolicy ( iFolderID ); iFolder ifolder = base.GetiFolder(iFolderID); UserPolicy userPolicy = UserPolicy.GetPolicy(ifolder.OwnerID); SystemPolicy systemPolicy = SystemPolicy.GetPolicy(); iFolderPolicy ifolderPolicy = iFolderPolicy.GetPolicy(iFolderID, GetAccessID()); int iFolderSharingStatus = ifolderPolicy.SharingStatus; int UserSharingStatus = userPolicy.SharingStatus; int GroupSharingStatus = UserPolicy.GetUserGroupSharingPolicy(ifolder.OwnerID); int SystemSharingStatus = systemPolicy.SharingStatus; if (((SystemSharingStatus & (int)Share.EnforcedSharing) == (int)Share.EnforcedSharing)) { /// If on system level or user level, enforcement of policy is there, it means the iFolder must not be shared if ((SystemSharingStatus & (int)Share.Sharing) == (int)Share.Sharing) { return(true); } return(false); } else if (((GroupSharingStatus & (int)Share.EnforcedSharing) == (int)Share.EnforcedSharing)) { if ((GroupSharingStatus & (int)Share.Sharing) == (int)Share.Sharing) { return(true); } return(false); } else if (((UserSharingStatus & (int)Share.EnforcedSharing) == (int)Share.EnforcedSharing)) { if ((UserSharingStatus & (int)Share.Sharing) == (int)Share.Sharing) { return(true); } return(false); } else { if (iFolderSharingStatus != 0) { if ((iFolderSharingStatus & (int)Share.Sharing) == (int)Share.Sharing || iFolderSharingStatus == 0) { /// it means, on iFolder Details page, admin had unchecked the box so sharing is enabled now return(true); } if ((iFolderSharingStatus & (int)Share.DisableSharing) == (int)Share.DisableSharing) { /// it means, on iFolder Details page, admin had checked the box so sharing is disabled return(false); } } else { /// no iFolder level policy present , now if current user is not an owner , then check for system level policy /// if current user is owner of the iFolder, then check for user level and then for system level if ((UserSharingStatus & (int)Share.Sharing) == (int)Share.Sharing) { /// it means, on User Details page, admin had unchecked the box so sharing is enabled now return(true); } if ((UserSharingStatus & (int)Share.DisableSharing) == (int)Share.DisableSharing) { /// it means, on User Details page, admin had checked the box so sharing is disabled return(false); } /// check for Group level policy as there was no user level or ifolder level policy applied /// No policy found on iFolder level or User level, no enforcement also, so follow group level if ((GroupSharingStatus & (int)Share.DisableSharing) == (int)Share.DisableSharing) { return(false); } if ((GroupSharingStatus & (int)Share.Sharing) == (int)Share.Sharing) { return(true); } /// check for system level policy as there was no user level or ifolder level policy applied /// No policy found on iFolder level or User level, no enforcement also, so follow system level if ((SystemSharingStatus & (int)Share.DisableSharing) == (int)Share.DisableSharing) { return(false); } if ((SystemSharingStatus & (int)Share.Sharing) == (int)Share.Sharing || SystemSharingStatus == 0) { return(true); } } } return(false); }