public override void AddUsersToRoles(string[] usernames, string[] roleNames) { Upn upn = new Upn(HttpContext.Current.User.Identity.Name); string[] adamUsernames = FromUpns(usernames); AuthorizationProxy.AddUsersToRoles(upn.TenantName, adamUsernames, roleNames); }
public override string[] GetRolesForUser(string username) { string tenantName = null; string tenantUsername = null; Upn.TryParse(username, out tenantName, out tenantUsername); return(AuthorizationProxy.GetRolesForUser(tenantName, tenantUsername)); }
public override bool IsUserInRole(string username, string roleName) { string tenantName = null; string tenantUsername = null; Upn.TryParse(username, out tenantName, out tenantUsername); return(AuthorizationProxy.IsUserInRole(tenantName, tenantUsername, roleName)); }
public override void CreateRole(string roleName) { string tenantName = null; string tenantUsername = null; Upn.TryParse(HttpContext.Current.User.Identity.Name, out tenantName, out tenantUsername); if (!string.IsNullOrEmpty(tenantName)) { AuthorizationProxy.CreateRole(tenantName, roleName); } }
public override void RemoveUsersFromRoles(string[] usernames, string[] roleNames) { string tenantName = null; string tenantUsername = null; Upn.TryParse(HttpContext.Current.User.Identity.Name, out tenantName, out tenantUsername); string[] adamUsernames = FromUpns(usernames); if (!string.IsNullOrEmpty(tenantName)) { AuthorizationProxy.RemoveUsersFromRoles(tenantName, adamUsernames, roleNames); } }
public override bool DeleteRole(string roleName, bool throwOnPopulatedRole) { string tenantName = null; string tenantUsername = null; Upn.TryParse(HttpContext.Current.User.Identity.Name, out tenantName, out tenantUsername); if (!string.IsNullOrEmpty(tenantName)) { AuthorizationProxy.DeleteRole(tenantName, roleName); } return(true); }
public override bool RoleExists(string roleName) { string tenantName = null; string tenantUsername = null; Upn.TryParse(HttpContext.Current.User.Identity.Name, out tenantName, out tenantUsername); if (!string.IsNullOrEmpty(tenantName)) { return(AuthorizationProxy.RoleExists(tenantName, roleName)); } else { return(false); } }
public override string[] GetAllRoles() { string tenantName = null; string tenantUsername = null; Upn.TryParse(HttpContext.Current.User.Identity.Name, out tenantName, out tenantUsername); if (!string.IsNullOrEmpty(tenantName)) { return(AuthorizationProxy.GetAllRoles(tenantName)); } else { return(null); } }
/// <summary> /// Get all action codes for a given user. /// </summary> /// <param name="userName">User Name</param> /// <returns>Action Codes.</returns> public override string[] GetActionsForUser(string userName) { if (string.IsNullOrEmpty(userName)) { throw new ArgumentNullException("userName"); } if (_cacheManager == null) { throw new HiiP.Framework.Common.BusinessException("Uable to create cache storage."); } string cacheKey = ActionsCacheKeyPrefix + userName; var data = this._cacheManager.GetData(cacheKey) as string[]; if (data == null) { using (var proxy = new AuthorizationProxy()) { data = proxy.GetActionsForUser(this.ApplicationName, userName); this._cacheManager.Add(cacheKey,data ,CacheItemPriority.None,null,new AbsoluteTime(ParameterUtil.DefaultCacheTimeSpan)); } } return data ; }