Beispiel #1
0
        public async Task <ServiceResponse <IEnumerable <string> > > GetRoles(string applicationName)
        {
            return(await ExecuteServiceAsync <IEnumerable <string> >(async response =>
            {
                using (var session = GetRepositorySession())
                {
                    var repo = new IdentityRepository(session);
                    var data = await repo.GetRoles(applicationName);

                    response.TotalResultCount = data.TotalResultCount;
                    return data.Value;
                }
            }));
        }
Beispiel #2
0
        /// <summary>
        /// Get the redirected url base on the role of user.
        /// If role of user is admin then redirect url of admin site
        /// If role of user is User than redirect url of user site
        /// </summary>
        /// <param name="roleId"></param>
        /// <returns></returns>
        private string GetRedirectUrl(string roleId)
        {
            string roleName = _identityRepository.GetRoles().Where(r => r.RoleId.Equals(roleId, StringComparison.OrdinalIgnoreCase)).SingleOrDefault().Name;

            switch (roleName)
            {
            case RoleConstants.UserRole:
                return(baseUrlBitzerIoC);

            case RoleConstants.AdminRole:
                return(baseUrlBitzerIoCAdmin);

            default:
                return(null);
            }
        }