public PlatformFolder(IPlatformSession session, IPlatformUser user, string uuid) : base(session, user) { Contract.Requires(session != null); Contract.Requires(user != null); Uuid = uuid; }
public async Task <ActionResult> SimLogin([FromBody] SimLoginRequestDTO request) { LoginResponseDTO res = new LoginResponseDTO(); try { IPlatformSession session = ClusterClient.GetGrain <IPlatformSession>(request.user_name); Account account = await session.VerifyAccount(Platform.Sim, request.user_name); if (account == null) { throw new Exception($"VerifyAccount cant found {request.user_name}"); } string access_token = JWT.GetAccessToken(account); await session.RefreshToken(access_token); res.data = access_token; res.result = LoginResult.Success; } catch (Exception ex) { res.result = LoginResult.None; res.data = ex.ToString(); Logger.LogError(ex.ToString()); } return(Json(res)); }
public PlatformUser(IPlatformSession session, JToken token) : base(session) { Id = token.SelectToken("id").Value<string>(); Email = token.SelectToken("email").Value<string>(); Name = token.SelectToken("name").Value<string>(); Uuid = token.SelectToken("uuid").Value<string>(); }
public PlatformNotificationListener(IPlatformSession session, IPlatformUser user, IWorkshareOnline workshare) : base(session, user) { Contract.Requires(session != null); Contract.Requires(user != null); this.Events = workshare.Events; }
public PlatformNotification(IPlatformSession session, IPlatformUser user, Newtonsoft.Json.Linq.JToken token) : base(session, user) { this.Id = token.SelectToken("id").Value<string>(); this.Noun = token.SelectToken("noun").Value<string>(); this.Verb = token.SelectToken("verb").Value<string>(); this.CreatorUuid = token.SelectToken("creator").SelectToken("uuid").Value<string>(); }
public PlatformSecurity(IPlatformSession session, IPlatformUser user) : base(session, user) { Contract.Requires(session != null); Contract.Requires(user != null); _sso = new SSOModule(); _ssoManager = _sso.ResolveSSOManager(); }
public PlatformVersion(IPlatformSession session, IPlatformUser user, JToken content, int currentVersion) { this.Id = content.SelectToken("id").Value<int>(); this.ParentId = FileId = content.SelectToken("file_id").Value<int>(); this.Name = content.SelectToken("file_name").Value<string>(); this.CreatedAt = content.SelectToken("created_at").Value<DateTime>(); this.Number = content.SelectToken("version").Value<int>(); this.IsLatest = currentVersion == Number; Creator = new PlatformUser(session, content.SelectToken("creator")); }
public PlatformAccount(IPlatformSession session, JToken token) : base(session) { Name = token.SelectToken("name").Value<string>(); _customLogoUrl = token.SelectToken("custom_logo").Value<string>(); if (string.IsNullOrEmpty(_customLogoUrl)) { _customLogoUrl = Session.Host.Url; if (!_customLogoUrl.EndsWith("/")) _customLogoUrl += "/"; _customLogoUrl += "images/workshare_logo.png"; } }
public async Task <ActionResult> WeChatLogin([FromBody] WeChatLoginRequestDTO request) { LoginResponseDTO res = new LoginResponseDTO(); try { string app_id = Configuration.GetSection("WeChat")["AppId"]; string app_secrect = Configuration.GetSection("WeChat")["AppSecret"]; string url = $"https://api.weixin.qq.com/sns/jscode2session?appid={app_id}&secret={app_secrect}&js_code={request.code}&grant_type=authorization_code"; var client = HttpClients.CreateClient(); var json = await client.GetStringAsync(url); dynamic response = JsonConvert.DeserializeObject <dynamic>(json); if (response.errcode == 0) { string unionid = (string)response.unionid; IPlatformSession session = ClusterClient.GetGrain <IPlatformSession>(unionid); Account account = await session.VerifyAccount(Platform.WeChat, unionid); if (account == null) { throw new Exception($"VerifyAccount cant found {unionid}"); } string access_token = JWT.GetAccessToken(account); await session.RefreshToken(access_token); res.data = access_token; res.result = LoginResult.Success; } else { res.result = LoginResult.WeChatLoginFaild; res.data = (string)response.errmsg; } } catch (Exception ex) { res.result = LoginResult.WeChatLoginFaild; res.data = ex.ToString(); Logger.LogError(ex.ToString()); } return(Json(res)); }
public PlatformFile(IPlatformSession session, IPlatformUser user, JToken content) : base(session, user) { Contract.Requires(session != null); Contract.Requires(user != null); Contract.Requires(content != null); Id = content.SelectToken("id").Value<long>(); ParentId = content.SelectToken("folder_id").Value<long>(); Version = content.SelectToken("version").Value<int>(); Size = content.SelectToken("size").Value<long>(); Name = content.SelectToken("file_name").Value<string>(); Password = content.SelectToken("password").Value<string>(); Created = content.SelectToken("created_at").Value<DateTime>(); LastUpdated = content.SelectToken("updated_at").Value<DateTime>(); CommentsCount = content.SelectToken("comments_count").Value<int?>() ?? 0; FriendlyNameWithoutExt = content.SelectToken("name").Value<string>(); Uuid = content.SelectToken("uuid").Value<string>(); }
public PlatformFolder(IPlatformSession session, IPlatformUser user, IPlatformFolder parentFolder, JToken content) : base(session, user) { Contract.Requires(session != null); Contract.Requires(user != null); Contract.Requires(content != null); Parent = parentFolder; Id = content.SelectToken("id").Value<long>(); Name = content.SelectToken("name").Value<string>(); Description = content.SelectToken("description").Value<string>(); FileCount = content.SelectToken("file_counter").Value<long>(); FolderCount = content.SelectToken("folder_counter").Value<long>(); MemberCount = content.SelectToken("members_counter").Value<long>(); ParentId = content.SelectToken("parent_id").Value<long?>(); Url = content.SelectToken("url").Value<string>(); Uuid = content.SelectToken("uuid").Value<string>(); Owner = new PlatformUser(session, content.SelectToken("owner")); Permissions = new PlatformPermissions(content, content.SelectToken("permissions")); IsOwner = user.Email == Owner.Email; }
public PlatformUser(IPlatformSession session) : base(session) { AccountId = OptionApi.GetEncrypted("SendLinkAccountId", Entropy); Id = OptionApi.GetEncrypted("SendLinkUserId", Entropy); }
public PlatformCommenting(IPlatformSession session, IPlatformUser user) : base(session, user) { Contract.Requires(session != null); Contract.Requires(user != null); }
public PlatformFileTransfer(IPlatformSession session, IPlatformUser user) : base(session, user) { Contract.Requires(session != null); Contract.Requires(user != null); }
public PlatformFolders(IPlatformSession session, IPlatformUser user) : base(session, user) { Contract.Requires(session != null); Contract.Requires(user != null); }
public PlatformGroups(IPlatformSession session, IPlatformUser user) : base(session, user) { }
public PlatformNotifications(IPlatformSession session, IPlatformUser user) : base(session, user) { }
public PlatformVisits(IPlatformSession session, IPlatformUser user) : base(session, user) { }
public PlatformAvatarCache(IPlatformSession session, IPlatformUser user) : base(session, user) { InitializeCache(); }