realm

细说shiro之一:shiro简介

╄→гoц情女王★ 提交于 2020-01-05 09:00:50
官网: https://shiro.apache.org/ 一. Shiro是什么 Shiro是一个Java平台的开源权限框架,用于认证和访问授权。具体来说,满足对如下元素的支持: 用户,角色,权限(仅仅是操作权限,数据权限必须与业务需求紧密结合),资源(url)。 用户分配角色,角色定义权限。 访问授权时支持角色或者权限,并且支持多级的权限定义。 Q:对组的支持? A:shiro默认不支持对组设置权限。 Q:是否可以满足对组进行角色分配的需求? A:扩展Realm,可以支持对组进行分配角色,其实就是给该组下的所有用户分配权限。 Q:对数据权限的支持? 在业务系统中定义? A:shiro仅仅实现对操作权限的控制,用于在前端控制元素隐藏或者显示,以及对资源访问权限进行检查。数据权限与具体的业务需求紧密关联,shiro本身无法实现对数据权限的控制。 Q:动态权限分配? A:扩展org.apache.shiro.realm.Realm,支持动态权限分配。 Q:与Spring集成? A:可以支持与Spring集成,shiro还支持jsp标签。 二. 系统架构 在shiro架构中,有3个最主要的组件:Subject,SecurityManager,Realm。 Subject本质上就是当前访问用户的抽象描述。 SecurityManager是Shiro架构中最核心的组件

Swift 4 Codable Realm Object Subclasses

大城市里の小女人 提交于 2020-01-05 06:38:10
问题 trying to switch some of my codebase over to Swift 4's new nifty Codable protocol. My setup looks something like this: class Base: Object, Codable { dynamic var id: String = "" dynamic var timestamp: String = "" private enum CodingKeys: String, CodingKey { case id = "_id" case timestamp = "timestamp" } } class User: Base { dynamic var name: String = "" private enum CodingKeys: String, CodingKey { case name = "name" } required init(from decoder: Decoder) throws { let container = try decoder

Best practice solution for storing “unsigned long long” number in Realm

牧云@^-^@ 提交于 2020-01-05 06:37:05
问题 I have to store large numbers in Realm storage like 14000822124935161134 . Currently I store them by changing the type of them to string as follows and then save it: NSMutableDictionary *itemInsert = [item mutableCopy]; if([item valueForKey:@"timestamp"]) { unsigned long long timestamp = [[item valueForKey:@"timestamp"] unsignedLongLongValue]; [itemInsert setObject:[NSString stringWithFormat:@"%llu", timestamp] forKey:@"timestamp"]; } RLMRealm *realm = [RLMRealm defaultRealm]; [realm

Android, Realm, Gradle: Error:Annotation processor: RealmProcessor not found

不打扰是莪最后的温柔 提交于 2020-01-05 05:48:08
问题 Android Studio 2.3.3 My project bulid.gradle: // Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { ext.kotlin_version = '1.1.3' repositories { jcenter() } dependencies { classpath 'com.android.tools.build:gradle:2.3.3' classpath 'com.google.gms:google-services:2.0.0-alpha6' classpath "io.realm:realm-gradle-plugin:3.5.0" classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" // NOTE: Do not place your application

Best Way to Build a Pre-Filled Realm Database

为君一笑 提交于 2020-01-05 04:26:08
问题 My app (iOS) will have a ton of data built in (and not synced to a server). I know I can take a pre-filled realm database and copy it over when the app is first used, but what I don't know is: What is the best way to build that pre-filled database? Should modify my app, to statically create the realm database, by hardcoding all the objects and relations, then pull the database from the emulator: let car1 = Car(color: "red") ... let car230 = Car(color: "blue") ... try realm.write{ realm.add

Why is my property absent from the Realm object?

我与影子孤独终老i 提交于 2020-01-05 04:04:25
问题 I'm using Realm for persistence and I cannot access properties which are marked as readonly. More accurately, I can print them using dot notation, but po object only shows the readwrite properties, and trying to access readonly properties using objectsWhere crashes. I've tested using a standard NSObject class and the issue disappears (for po obviously), which makes me wonder why/if Realm ignores readonly properties? 回答1: That's correct! If a property is marked as readonly , Realm ignores it

Realm Serializing Data from Map

萝らか妹 提交于 2020-01-05 03:29:54
问题 I am working with Realm for Android, I had to work with storage of maps. However, Realm does not support maps and so I made a workaround for this as suggested here But when I am serializing the data I am storing to a JSON, the output is way off of what is expected. The expected JSON: { "key1": "value1", "key2": "value2", "key3": "value3", "key4": "value4" } And what I am getting is: [{ "key": "key1", "value": "value1" }, { "key": "key2", "value": "value2" }, { "key": "key3", "value": "value3"

Realm Swift callback function

ε祈祈猫儿з 提交于 2020-01-04 14:15:02
问题 I use swift3 and Realm 2.3. And I need callback after transaction is finished. for example, I have a code as below, how can I get call back after a realm data transaction is finished ? DispatchQueue.main.async { try! self.realm.write { self.realm.add(friendInfo, update: true) } } 回答1: Transactions are executed synchronously. So you can just perform the code right after you execute the transaction. DispatchQueue.main.async { try! self.realm.write { self.realm.add(friendInfo, update: true) }

How to check for null on Nullable types using Linq expression in Realm?

夙愿已清 提交于 2020-01-04 09:28:09
问题 I want to get all elements where the Modified property isn't set but can't seem to get it to work with Realm. Sample Code: public class FooModel : RealmObject { public DateTimeOffset? Modified { get; set; } } ... public List<FooModel> GetAllUnmodified() { var realm = Realm.GetInstance(); //doesn't work var result1 = realm.All<FooModel>().Where(model => model.Modified == null).ToList(); //doesn't work var result2 = realm.All<FooModel>().Where(model => !model.Modified.HasValue).ToList(); /

How can I ensure Realm schema is identical across Android and iOS?

…衆ロ難τιáo~ 提交于 2020-01-04 05:23:09
问题 I'm looking at using Realm for a project where we have both iOS and Android clients. It looks like there's not any way to ensure that the database schemas are the same on both platforms, such that the data stores could be exchanged between them. Since the schema is effectively defined in code, how can I ensure they remain compatible? 回答1: The Realm browser can generate Models from existing Realm files in multiple languages. So maybe you could create a realm file on one platform and then use