parsav  Diff

Differences From Artifact [b8bbc4e0ec]:

To Artifact [0ebd27b207]:


    20     20   		'avoid', -- posts will be kept out of the timeline but will show on users' posts and in conversations
    21     21   		'exclude', -- own posts will not be visible to this user
    22     22   	};
    23     23   	credset = lib.set {
    24     24   		'pw', 'otp', 'challenge', 'trust'
    25     25   	};
    26     26   	privset = lib.set {
    27         -		'post', 'edit', 'account', 'upload', 'moderate', 'admin', 'invite'
           27  +		'post', 'edit', 'account', 'upload', 'artifact', 'moderate', 'admin', 'invite'
    28     28   	};
    29     29   	powerset = lib.set {
    30     30   		-- user powers -- default on
    31     31   		'login', -- not locked out
    32     32   		'visible', -- account & posts can be seen by others
    33     33   		'post', -- can do poasts
    34     34   		'shout', -- posts show up on local timeline
................................................................................
    52     52   		'invite' -- *unlimited* invites
    53     53   	};
    54     54   	prepmode = lib.enum {
    55     55   		'full','conf','admin'
    56     56   	}
    57     57   }
    58     58   
    59         -m.privmap = {}
    60         -do local struct pt { name:lib.mem.ptr(int8), priv:m.powerset }
    61         -for k,v in pairs(m.powerset.members) do
    62         -	m.privmap[#m.privmap + 1] = quote
    63         -		var ps: m.powerset ps:clear()
    64         -		(ps.[v] << true)
    65         -	in pt {name = lib.str.plit(v), priv = ps} end
    66         -end end
           59  +local function setmap(set)
           60  +	local map = {}
           61  +	local struct pt { name:lib.mem.ptr(int8), val:set }
           62  +	for k,v in pairs(set.members) do
           63  +		map[#map + 1] = quote
           64  +			var ps: set ps:clear()
           65  +			(ps.[v] << true)
           66  +		in pt {name = lib.str.plit(v), val = ps} end
           67  +	end
           68  +	return map
           69  +end
           70  +m.powmap = setmap(m.powerset)
           71  +m.privmap = setmap(m.privset)
    67     72   
    68     73   terra m.powerset:affect_users()
    69     74   	return self.purge() or self.discipline() or self.herald() or
    70     75   	       self.elevate() or self.demote() or self.cred()
    71     76   end
    72     77   
    73     78   local str = rawstring
................................................................................
   408    413   	actor_notice_enum: {&m.source, uint64} -> lib.mem.ptr(m.notice)
   409    414   	actor_rel_create: {&m.source, uint16, uint64, uint64} -> {}
   410    415   	actor_rel_destroy: {&m.source, uint16, uint64, uint64} -> {}
   411    416   	actor_rel_calc: {&m.source, uint64, uint64} -> m.relationship
   412    417   
   413    418   	auth_enum_uid:    {&m.source, uint64}    -> lib.mem.lstptr(m.auth)
   414    419   	auth_enum_handle: {&m.source, rawstring} -> lib.mem.lstptr(m.auth)
   415         -	auth_attach_pw:  {&m.source, uint64, bool, pstr, pstr} -> {}
          420  +	auth_attach_pw:  {&m.source, uint64, bool, pstr, pstr} -> uint64
   416    421   	auth_attach_key: {&m.source, uint64, bool, pstr, pstr} -> {}
   417    422   		-- uid: uint64
   418    423   		-- reset: bool (delete other passwords?)
   419    424   		-- pw: pstring
   420    425   		-- comment: pstring
          426  +	auth_privs_set: {&m.source, uint64, m.privset} -> {}
   421    427   	auth_purge_pw: {&m.source, uint64, rawstring} -> {}
   422    428   	auth_purge_otp: {&m.source, uint64, rawstring} -> {}
   423    429   	auth_purge_trust: {&m.source, uint64, rawstring} -> {}
   424    430   	auth_sigtime_user_fetch: {&m.source, uint64} -> m.timepoint
   425    431   		-- authentication tokens and accounts have a property that controls
   426    432   		-- whether auth cookies dated to a certain point are valid. cookies
   427    433   		-- that are generated before the timepoint are considered invalid.
................................................................................
   443    449   			-- artifact id: uint64
   444    450   			-- detach: bool
   445    451   	post_retweet: {&m.source, uint64, uint64, bool} -> {}
   446    452   	post_like: {&m.source, uint64, uint64, bool} -> {}
   447    453   			-- undo: bool
   448    454   	post_react: {&m.source, uint64, uint64, pstring} -> {}
   449    455   			-- emoji: pstring (null to delete previous reaction, otherwise adds/changes)
          456  +	post_act_cancel: {&m.source, uint64} -> {}
   450    457   	post_liked_uid: {&m.source, uint64, uint64} -> bool
   451    458   	post_reacted_uid: {&m.source, uint64, uint64} -> bool
          459  +	post_act_fetch_notice: {&m.source, uint64} -> m.notice
   452    460   
   453    461   	thread_latest_arrival_calc: {&m.source, uint64} -> m.timepoint
   454    462   
   455    463   	artifact_instantiate: {&m.source, lib.mem.ptr(uint8), lib.mem.ptr(int8)} -> uint64
   456    464   		-- instantiate an artifact in the database, either installing a new
   457    465   		-- artifact or returning the id of an existing artifact with the same hash
   458    466   			-- artifact: bytea