static AclScope _aclScopeFromEntity()

in lib/storage.dart [134:159]


  static AclScope _aclScopeFromEntity(String entity) {
    if (entity.startsWith('user-')) {
      var tmp = entity.substring(5);
      var at = tmp.indexOf('@');
      if (at != -1) {
        return AccountScope(tmp);
      } else {
        return StorageIdScope(tmp);
      }
    } else if (entity.startsWith('group-')) {
      return GroupScope(entity.substring(6));
    } else if (entity.startsWith('domain-')) {
      return DomainScope(entity.substring(7));
    } else if (entity.startsWith('allAuthenticatedUsers-')) {
      return AclScope.allAuthenticated;
    } else if (entity.startsWith('allUsers-')) {
      return AclScope.allUsers;
    } else if (entity.startsWith('project-')) {
      var tmp = entity.substring(8);
      var dash = tmp.indexOf('-');
      if (dash != -1) {
        return ProjectScope(tmp.substring(dash + 1), tmp.substring(0, dash));
      }
    }
    return OpaqueScope(entity);
  }